'use strict';

module.exports = appInfo => {
  const config = {};
  // should change to your own
    config.keys = appInfo.name + '_1499319143999_1830';
    config.view = {
        mapping: {
          '.ejs': 'ejs',
        },
    }

    config.sequelize = {
        dialect: 'mysql',
        host: '116.62.187.179',
        user: 'root',
        password: 'index1130',
        port: 3306,
        database: 'fd_clean',
        timezone:'+08:00'
    };

    config.security = {
        xframe: {
          enable: false,
        },
        csrf: {
          // 判断是否需要 ignore 的方法，请求上下文 context 作为第一个参数
          ignore: ctx => true,
        },
    }


    config.jwt = {
        enable: true,
        package: 'egg-jwt',
        secret: '123456',
        match: '/jwt', // optional
    }

    config.cors = {
        origin:"*",
        allowMethods : 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
        credentials:true,
    }

    config.multipart = {
        fileExtensions: [
          '.xls',
          '.xlsx',
          '.pdf'
        ],
        fileSize: '50mb',
    }

    config.redis = {
        client: {
          port: 6379, // Redis port
          host: '127.0.0.1', // Redis host
          password: 'zpds20152015',
          db: 0,
        },
    }

    config.sessionRedis = {
        name: 'fd_clean', // specific instance `session` as the session store
    }

    // 每次请求 如果session生命只剩一半，自动延长
    config.session = {
        renew:true
    }

    config.logger = {
        dir: 'log',
        level: 'INFO',
        consoleLevel: 'DEBUG',
    };

    config.middleware = [ 'errorHandler' , 'authHandler' ]


    //上传文件路径，根据自身开发环境配置
    config.uploadDir = '/Users/vincent/workspace/fd_clean/fd_clean/app/public/upload/'
    //  文件app路径 根据自身环境配置
    config.fileDir = '/Users/vincent/workspace/fd_clean/fd_clean/app'
    config.tempname = 'temp'  //图片缓存文件夹名
    config.archive = 'archive'  //可归档 文件夹
    config.tempSwitch = 'on' //on 开启图片temp缓存文件夹，其他字符 关闭


  // add your config here
    config.weappSDK = {
        appId: 'wx5c54b8004f2b927a',
        appSecret: '31ef576c8a8fddaae88b8c47a977dd2b',
    };
    config.sms = {
        apikey : 'aa231ebc80768ae6643f7e59838aec73',
        verify_code :'2136192'
    }

    config.baidu = {
        APP_ID : '11500699',
        API_KEY : '7xpkPtskVwN3g9DHWUvkQ08k',
        SECRET_KEY : 'FZ9G7dRzxTZwXusdnGeX1zGocpY2x1Po'
    }
  return config;
};
